package com.yeyks.task;

import cn.hutool.core.date.DateUtil;
import com.yeyks.common.constants.activity.RedisKeyPreConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 抽奖定时任务
 *
 * @author shuai
 * @date 2019/11/12 14:18
 */
@Component
@Slf4j
public class LotteryTask {
//    @Autowired
//    private RedisTemplate redisTemplate;
//
//    @Scheduled(cron = "${schedule.lottery.clear}")
//    private void lotteryTask() {
//        log.info("抽奖定时任务执行-----------，time = {}", DateUtil.formatDateTime(new Date()));
//        redisTemplate.delete(getZJLotteryByKey());
//        redisTemplate.delete(getZJLCountByKey());
//        log.info("抽奖定时任务执行end");
//    }
//
//    private String getZJLotteryByKey() {
//        return RedisKeyPreConstant.STATISTICAL_DATA_PRE + RedisKeyPreConstant.STATISTICAL_DATA_MIDDLE_ACTIVITY + RedisKeyPreConstant.STATISTICAL_DATA_MIDDLE_ACTIVITY_END_ZHOUJIELUN_LOTTERY_ALLOW;
//    }
//
//    private String getZJLCountByKey() {
//        return RedisKeyPreConstant.STATISTICAL_DATA_PRE + RedisKeyPreConstant.STATISTICAL_DATA_MIDDLE_ACTIVITY + RedisKeyPreConstant.STATISTICAL_DATA_MIDDLE_ACTIVITY_END_ZHOUJIELUN_LOTTERY_COUNT;
//    }
}
